home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / cp1.zip / SOUND1.ASM < prev    next >
Assembly Source File  |  1993-05-12  |  6KB  |  157 lines

  1. ===========================================================================
  2.  BBS: The Abacus * HST/DS * Potterville MI
  3. Date: 05-04-93 (07:33)             Number: 101
  4. From: KOEN LESENNE                 Refer#: NONE
  5.   To: KIRBY WALLACE                 Recvd: NO  
  6. Subj: Kill the speaker, kill t       Conf: (36) C Language
  7. ---------------------------------------------------------------------------
  8. Hello Kirby!
  9.  
  10. Woensdag April 28 1993, Kirby Wallace writes to All:
  11.  
  12.  KW> Tell me, has anyone ever successfully silenced the IBM PC speaker?
  13.  KW> I've dl'd about three of four different shareware products (none
  14.  KW> with source), but all of them just catch BIOS "induced" beeps;
  15.  KW> other sounds get right through.
  16.  
  17. I captured this routine a while ago in the PASCAL area ...
  18. May be it can help you ... (check especially the end of the message)
  19. BTW, I haven't tried it out yet !!!
  20.  
  21. ; ***********************************************************************
  22. ; *                                                                     *
  23. ; * Author      B.B.Bloksma                                             *
  24. ; * Date        15/08/88                                                *
  25. ; *                                                                     *
  26. ; * File name   SOUND.ASM                                               *
  27. ; *                                                                     *
  28. ; * Purpose     Provide common error sounds for pascal                  *
  29. ; *                                                                     *
  30. ; * Subroutines :       Warble  - Sound used in error routines          *
  31. ; *                     Beep    - Sound used when wrong key pressed     *
  32. ; *                     Sweep   - Sound with upgoing frequency          *
  33. ; *                     Siren   - Sound going up and down in frequency  *
  34. ; *                                                                     *
  35. ; ***********************************************************************
  36.  
  37.                 PUBLIC  WARBLE,BEEP,SIREN,SWEEP
  38.  
  39.                 NAME    SOUND
  40. CODE            SEGMENT BYTE PUBLIC 'CODE'
  41.                 ASSUME  CS:CODE
  42.  
  43. ; DATA
  44.  
  45. FREQ            DW      00              ; Frequency for speaker to be set at
  46.  
  47. ; -----------------------------------------------------------------------
  48.  
  49. WARBLE          PROC    FAR
  50.                 PUSH    BP
  51.                 MOV     BP,SP
  52.  
  53.                 IN      AL,61h          ; Save speaker port contents
  54.                 PUSH    AX
  55.  
  56.                 MOV     DX,0Bh
  57. W_MAIN:         PUSH    DX              ; SoundSet uses DX
  58.                 MOV     FREQ,2500       ; frequency of 2500 Hz.
  59.                 CALL    SOUNDSET
  60.                 MOV     CX,2600h
  61. W_DELAY1:
  62.                 LOOP    W_DELAY1
  63.                 MOV     FREQ,32767      ; frequency of 32767 Hz.
  64.                 CALL    SOUNDSET        ;   You can't hear this frequency
  65.                 MOV     CX,1300h
  66. W_DELAY2:
  67.                 LOOP    W_DELAY2
  68.                 POP     DX
  69.                 DEC     DX
  70.                 JNZ     W_MAIN
  71.  
  72.                 POP     AX              ; Restore speaker port contents
  73.                 AND     AL,0FDh         ; Make sure the speaker is off
  74.                 OUT     61h,AL
  75.  
  76.                 POP     BP
  77.                 RET
  78. WARBLE          ENDP
  79.  
  80. ; -----------------------------------------------------------------------
  81.  
  82. BEEP            PROC    FAR
  83.                 PUSH    BP
  84.                 MOV     BP,SP
  85.                 IN      AL,61h          ; Save speaker port contents
  86.                 PUSH    AX
  87.  
  88.                 MOV     FREQ,175        ; frequency of 175 Hz.
  89.                 CALL    SOUNDSET
  90.                 MOV     CX,4B4Bh
  91. B_DELAY:
  92.                 LOOP    B_DELAY
  93.  
  94.                 POP     AX              ; Restore speaker port contents
  95.                 AND     AL,0FDh         ; Make sure the speaker is off
  96.                 OUT     61h,AL
  97.                 POP     BP
  98.                 RET
  99. BEEP            ENDP
  100.  
  101. ; -----------------------------------------------------------------------
  102.  
  103. SI_TOP          EQU     5000
  104. SI_BOTTOM       EQU     500             ; MUST be < SIREN_TOP
  105. SI_TIMES        EQU     4               ; Number of times to go up and down
  106. SI_SPEED        EQU     1               ; Speed at witch freq. changes
  107.  
  108. SIREN           PROC    FAR
  109.                 IN      AL,61h          ; Get speaker port contents
  110.                 PUSH    AX              ;  and save it
  111.  
  112.                 MOV     CX,SI_TIMES     ; Number of times
  113. SI_MAIN:        PUSH    CX              ; Save because slope uses CX
  114.                 MOV     FREQ,SI_BOTTOM  ; Start frequency
  115.                 MOV     BX,SI_TOP       ; End frequency
  116.                 MOV     CX,SI_SPEED
  117.                 CALL    SLOPE
  118.                 MOV     FREQ,SI_TOP     ; Start frequency
  119.                 MOV     BX,SI_BOTTOM    ; End frequency
  120.                 MOV     CX,SI_SPEED
  121.                 CALL    SLOPE
  122.                 POP     CX
  123.                 LOOP    SI_MAIN
  124.  
  125.                 POP     AX              ; Restore speaker port contents
  126.                 AND     AL,0FDh         ; Make sure speaker is off
  127.                 OUT     61h,AL
  128.                 RET
  129. SIREN           ENDP
  130.  
  131. ; -----------------------------------------------------------------------
  132.  
  133. SW_START        EQU     40
  134. SW_END          EQU     5000            ; MUST be  < SW_START
  135. SW_SPEED        EQU     60
  136.  
  137. SWEEP           PROC    FAR
  138.                 IN      AL,61h          ; Get speaker port contents
  139.                 PUSH    AX              ;   and save it
  140.  
  141.                 MOV     FREQ,SW_START   ; Start frequency
  142.                 MOV     BX,SW_END       ; End frequency
  143.                 MOV     CX,SW_SPEED
  144.                 CALL    SLOPE
  145.  
  146.                 POP     AX              ; Restore speaker port contents
  147.                 AND     AL,0FDh         ; Make sure the speaker is off
  148.                 OUT     61h,AL
  149.                 RET
  150. SWEEP           ENDP
  151.  
  152. ; -----------------------------------------------------------------------
  153.  
  154. SLOPE           PROC    NEAR
  155.                         ; FREQ has the frequency slope starts out with
  156.                         ; BX has the frequency at which slope stops
  157.